﻿using DoNetDrive.Core.Connector;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DoNetDrive.Connector.WindowsBLE
{
    public class BLEDetail : AbstractConnectorDetail
    {
        public const string BLETypeName = "WindowsBLEConnector";

        /// <summary>
        /// 蓝牙设备的地址 （MAC地址）
        /// </summary>
        public ulong BluetoothAddress { get; set; }

        public string BluetoothName { get; set; }

        public string ServiceUUID { get; set; }


        public BLEDetail(ulong addr, string name, string serviceUUID)
        {
            BluetoothAddress = addr;
            BluetoothName = name;
            ServiceUUID = serviceUUID;
        }

        public BLEDetail(ulong addr)
        {
            BluetoothAddress = addr;
        }

        public override string GetTypeName() => BLETypeName;
        public override string GetAssemblyName() => "DoNetDrive.Connector.WindowsBLE";
        public override string GetKey() => $"{GetTypeName()}_Addr:{BluetoothAddress}";

        public override bool Equals(INConnectorDetail other)
        {
            if (other == null) return false;
            BLEDetail o = other as BLEDetail;
            if (o == null) return false;
            return this.BluetoothAddress == o.BluetoothAddress;
        }

        public override string ToString() => $"{GetTypeName()}_Name:{BluetoothName} -- Addr:{BluetoothAddress}";




    }
}
